<template>
    <div class="city_container" >

        <div v-if="seen == false">
          <v-drivingschool :driving-data="drivingdata" :ishow="true"></v-drivingschool>
          <v-comodesc :driving-content="drivingcontent"></v-comodesc>
          <div class="subsection">
               <div class="subbutton" @click="gotoSign()">
                 确认报名
               </div>
           </div>  
        </div>
        
        <v-spinner :seen="seen">
       
        </v-spinner>
    </div>
</template>
<script>
    import Drivingschool from '../city/drivingschool/drivingschool.vue';
    import Spinner from '../component/spinner/spinner.vue';
    import Comodesc from '../combodetail/comodesc/comodesc.vue';
    export default {
      data() {
            return {
                lat:'39.915168',
                lng:'116.403875',
                drivingdata:"",
                drivingcontent:"",
                seen:true,
                commbo_id:"12312",
            }
      },
      created(){
           
      },
      methods:{  
          gotoSign:function(){
             //判断是否登陆过把帐号信息存在本地了
             if(localStorage.getItem("userinfo") == null){//未登陆
                this.$router.push("/sign/sign_index")
             }else{//登陆了
               this.commbo_id = this.$route.params.combo_id;//对应的路由参数
               var token = localStorage.getItem("userinfo").token;
               fetch("http://appsys.goxueche.com/App/Info/index.shtml?debug=1&method=apply&action=sign&token="+token+"&combo_id="+this.combo_id+"&driving_id="+driving_id+"&source=web").then(function(response){ return response.json();}
                ).then(function(data){

                })
             }
            
          }, 

      },
      mounted(){
        let that = this;
            this.commbo_id = this.$route.params.combo_id;//对应的路由参数
            this.seen = false;
             fetch("http://appsys.goxueche.com/App/Info/index.shtml?debug=1&method=detail&action=combo&combo_id="+this.commbo_id+"&lat="+this.lat+"&lng="+this.lng+"&source=web").then(function(response){
                    return response.json();
                  }).then(function(data){
                      that.drivingdata = data.data.driving_data;
                      that.drivingcontent = data.data;
                  })
      },
      components: {
        'v-drivingschool' : Drivingschool,
        'v-spinner' : Spinner,
        'v-comodesc' : Comodesc,
      },
    }
</script>

<style lang="scss" scoped>
   @import 'src/common/styles/mixins';
   .city_container{
    width: 100%;
    background:#f0f0f0;
   }
.subsection{
  width:100%;
  background:#fff;
  position:fixed;
  bottom:0;
  left:0;
  z-index:1;
  padding:px2rem(21) px2rem(34);
  div{
     width: px2rem(682);
     height: px2rem(86);
     background: #f95800;
     color:#fff;
     font-size: px2rem(30);
     @extend %box-center;
  }
}
</style>
<!-- //动态绑定伏组件中的data属性，用定义的名字来接 -->
<!-- 父－－－子组建通信 -->
<!--     父组件中 动态绑定父组件中的data属性，在子组建中通过props来接，可以自定义属性名 -->